<?php
include("include/config.inc.php");
if(!isset($_SESSION['s_activIdsAdmin']))
{
  header("Location:checkLogin.php");
}
else
{
	$userId = ($_SESSION['s_activIdsAdmin']);
  
  $o=0;
	$contractArray = array();
	$selectContract = "SELECT contractId,contractNo
	                     FROM contract";
	$selectContractRes = mysql_query($selectContract);   
	while($contractRow = mysql_fetch_array($selectContractRes))
	{
		$contractArray['contractId'][$o] = $contractRow['contractId'];
		$contractArray['contractNo'][$o] = $contractRow['contractNo'];
		$o++;
	}
	$l=0;
	$invoiceArray = array();
	$selectInvoice = "SELECT invoiceId,invoiceNo
	                    FROM invoice";
	$selectInvoiceRes = mysql_query($selectInvoice);
	while($invoiceRow = mysql_fetch_array($selectInvoiceRes))
	{
		$invoiceArray['invoiceId'][$l] = $invoiceRow['invoiceId'];
		$invoiceArray['invoiceNo'][$l] = $invoiceRow['invoiceNo'];
		$l++;
	}
	
	$q=0;
	$userArray = array();
	$selectInvoice = "SELECT userId,company
	                    FROM user";
	$selectInvoiceRes = mysql_query($selectInvoice);
	while($invoiceRow = mysql_fetch_array($selectInvoiceRes))
	{
		$userArray['userId'][$q]      = $invoiceRow['userId'];
		$userArray['company'][$q]     = $invoiceRow['company'];
		$q++;
	}
  
  include("bottom.php");
  $smarty->assign("contractArray",$contractArray);
  $smarty->assign("invoiceArray",$invoiceArray);
  $smarty->assign("userArray",$userArray);
  $smarty->display("myDoc.tpl");
}
?>